Skip to content

fix(kotlin): stop deprecations pointing at deprecated replacements - #731

Open
ayaangazali wants to merge 1 commit into
RunanywhereAI:mainfrom
ayaangazali:fix/kotlin-deprecation-targets
Open

fix(kotlin): stop deprecations pointing at deprecated replacements#731
ayaangazali wants to merge 1 commit into
RunanywhereAI:mainfrom
ayaangazali:fix/kotlin-deprecation-targets

Conversation

@ayaangazali

@ayaangazali ayaangazali commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

What is wrong

Six @Deprecated messages on the legacy extension surface tell the caller to move to a namespace method that is itself deprecated, so following the advice lands them on a second deprecation:

legacy extension current advice that target's own annotation
unloadModel models.unload(category) @Deprecated("Use unloadAll(category).")
stopSynthesis tts.stop() @Deprecated("Use the SpeechHandle returned by speak().")
stopSpeaking tts.stop() same
streamVAD vad.detectStream(audio, options) @Deprecated("Use vad.openStream(format, options).")
resetVAD vad.detectStream same
transcribeStream stt.transcribeStream(audio, options) @Deprecated("Use stt.openStream(format, options).")

The IDE shows the strikethrough and the message, the caller migrates, and gets struck through again. ReplaceWith is not involved in any of these, so nothing auto-applies, but the written guidance is a dead end and no gate covers it. check_deprecated_surfaces.sh tracks which deprecated surfaces exist against an allowlist; it does not check that a deprecation's target is supported.

What this changes

Each message now names the replacement the namespace's own annotation points at, so one hop reaches a supported API:

  • models.unloadAll(category)
  • interrupt() on the SpeechHandle returned by tts.speak()
  • vad.openStream(format, options), and close() on the VadStream it returns for the reset case
  • stt.openStream(format, options)

I took each target from the deprecated namespace method's own annotation rather than picking one, and confirmed the members exist: ModelsNamespace.unloadAll (:266), TtsNamespace.speak (:60) returning SpeechHandle with interrupt() (Results.kt:252), SttNamespace.openStream (:189), and VadStream.close() (Results.kt:315).

Message strings only. No signature, body, or ReplaceWith target changes, so this cannot alter behaviour.

How I found them

Collected the deprecated methods declared inside public/api/*Namespace.kt, then looked for any @Deprecated message elsewhere naming <namespace>.<method> for that set. Six hits, four files. After the change the same scan reports zero.

Worth noting the scan produced 31 raw hits at first and 25 were false positives, because a deprecated extension and the live namespace method often share a simple name (generate, rerank, diarize). Those messages are correct and I left them alone; only the six above name a target that really is deprecated.

Verification

  • ./gradlew :compileDebugKotlin --rerun-tasks -x :buildLocalJniLibs -x :downloadJniLibs -x :syncAndroidRuntimeLibs -Prunanywhere.useLocalNatives=false: BUILD SUCCESSFUL
  • ./gradlew ktlintMainSourceSetCheck: clean
  • git status shows only the four source files; the codegen the Gradle build runs left nothing behind

No test added: these are annotation strings, and a test asserting the text of a deprecation message would pin prose rather than behaviour.

Summary by CodeRabbit

  • Documentation
    • Updated deprecation guidance for model unloading, speech-to-text streaming, text-to-speech controls, and voice activity detection.
    • Deprecated APIs now point to the recommended replacement workflows, including stream handles and lifecycle methods.

Copilot AI lite review requested due to automatic review settings August 17, 2026 18:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Heads up on the red python-linux (3.9) and (3.12) cells here: they are not from this diff.

Both are red on main too, at b2d2ff6d (run 32011099890), with "The job has exceeded the maximum execution time of 1h30m0s". The job hangs inside auditwheel repair because the prep step's ln -sf libonnxruntime.so lib/libonnxruntime.so.1 overwrites the middle link of the chain the new RunAnywhere desktop prebuilt ships, turning libonnxruntime.so and libonnxruntime.so.1 into a symlink loop.

I opened #736 with the evidence and a one-line guard. Nothing to do on this PR; every other check here is green.

@ayaangazali
ayaangazali force-pushed the fix/kotlin-deprecation-targets branch from 511f1cd to 2736edc Compare August 22, 2026 17:38
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e6f99f49-e6ca-4d31-8dcb-844b84ad74d7

📥 Commits

Reviewing files that changed from the base of the PR and between c4a8fb2 and 2736edc.

📒 Files selected for processing (4)
  • bindings/kotlin/src/main/kotlin/com/runanywhere/sdk/public/extensions/Models/RunAnywhereModelLifecycle.kt
  • bindings/kotlin/src/main/kotlin/com/runanywhere/sdk/public/extensions/STT/RunAnywhereSTT.kt
  • bindings/kotlin/src/main/kotlin/com/runanywhere/sdk/public/extensions/TTS/RunAnywhereTTS.kt
  • bindings/kotlin/src/main/kotlin/com/runanywhere/sdk/public/extensions/VAD/RunAnywhereVAD.kt

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

Updated Kotlin deprecation messages for model, STT, TTS, and VAD APIs. The messages now reference current replacement APIs and stream lifecycle methods.

Changes

Kotlin API guidance

Layer / File(s) Summary
Replacement API deprecation messages
bindings/kotlin/.../Models/RunAnywhereModelLifecycle.kt, bindings/kotlin/.../STT/RunAnywhereSTT.kt, bindings/kotlin/.../TTS/RunAnywhereTTS.kt, bindings/kotlin/.../VAD/RunAnywhereVAD.kt
Updated deprecated API messages to reference unloadAll, openStream, SpeechHandle.interrupt(), and closing VadStream.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 2736e

This change only corrects migration guidance for deprecated Kotlin APIs without changing signatures, runtime behavior, or replacement mechanics. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: sanchitmonga22

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 10.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 10 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the Kotlin deprecation guidance fix and matches the main changes.
Description check ✅ Passed The description explains the problem, lists the replacement APIs, and documents verification results, but it omits the repository template headings and checklist selections.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ayaangazali

Copy link
Copy Markdown
Contributor Author

Rebased onto 0b95af9ae (0.20.27), diff unchanged.

Still reproduces. Re-ran the check against current main: five Kotlin deprecations still send the caller to a replacement that is itself deprecated.

RunAnywhereModelLifecycle.kt:100   -> RunAnywhere.models.unload
RunAnywhereTTS.kt:180              -> RunAnywhere.tts.stop
RunAnywhereTTS.kt:244              -> RunAnywhere.tts.stop
RunAnywhereVAD.kt:96               -> RunAnywhere.vad.detectStream
RunAnywhereSTT.kt:88               -> RunAnywhere.stt.transcribeStream

Following any of those trades one deprecation warning for another. This retargets them at the live replacements.

For context on scope: the same defect exists in Swift and Web and is #762, and ReplaceWith targets elsewhere in the Kotlin SDK all resolve correctly, so this is the complete Kotlin set rather than a sample.

@ayaangazali
ayaangazali force-pushed the fix/kotlin-deprecation-targets branch from 9d75f38 to 327dfe9 Compare August 25, 2026 19:04
@ayaangazali

Copy link
Copy Markdown
Contributor Author

Still reproduces on c11f78ef4. Re-checked each of the four replacement targets this time rather than the diff, and every one of them is itself deprecated on main:

ModelsNamespace.kt:281  @Deprecated("Use unloadAll(category).", ReplaceWith("unloadAll(category)"))
                        public suspend fun unload(category: ModelCategory? = null)

SttNamespace.kt:205     @Deprecated("Use stt.openStream(format, options).", ReplaceWith("openStream(format, options)"))
                        public fun transcribeStream(

TtsNamespace.kt:80      @Deprecated("Use the SpeechHandle returned by speak().")
                        public suspend fun stop()

VadNamespace.kt:186     @Deprecated("Use vad.openStream(format, options).", ReplaceWith("openStream(format, options)"))
                        public fun detectStream(

So the six extension deprecations this PR touches send a caller to a symbol that immediately warns again and carries its own ReplaceWith pointing one hop further on. Following the IDE quick-fix gets you a second deprecation warning rather than working code. The fix is to name the end of the chain directly, which is what these six messages now do.

The replacements they point at all exist and are not deprecated (ModelsNamespace.unloadAll:266, SttNamespace.openStream:189, VadNamespace.openStream:171, and the SpeechHandle returned by tts.speak()).

Text-only change to @Deprecated messages, no behaviour. Merges clean, CI green.

ayaangazali added a commit to ayaangazali/runanywhere-sdks that referenced this pull request Sep 2, 2026
…ated API

stopSynthesis/stopSpeaking in both SDKs tell the caller to use tts.stop(),
which is itself deprecated in favour of the SpeechHandle returned by speak().
Following the advice trades one deprecation warning for another, and on Swift
`renamed:` gives Xcode a fix-it that performs the bad migration for you.

Retarget all four at the SpeechHandle, matching the wording tts.stop() already
uses. Swift drops `renamed:` for `message:` because the replacement is a
returned handle, not a symbol that can be substituted at the call site.
Kotlin's equivalents were fixed in RunanywhereAI#731.
Six @deprecated messages on the legacy extension surface name a namespace
method that is itself deprecated, so following the migration advice lands the
caller on a second deprecation:

  unloadModel      -> models.unload(category)          @deprecated -> unloadAll(category)
  stopSynthesis    -> tts.stop()                       @deprecated -> SpeechHandle
  stopSpeaking     -> tts.stop()                       @deprecated -> SpeechHandle
  streamVAD        -> vad.detectStream(audio, options) @deprecated -> openStream(format, options)
  resetVAD         -> vad.detectStream                 @deprecated -> openStream(format, options)
  transcribeStream -> stt.transcribeStream(audio, ...) @deprecated -> openStream(format, options)

Each now names the replacement the namespace's own annotation points at, so
one hop reaches a supported API:

  models.unloadAll(category)
  interrupt() on the SpeechHandle returned by tts.speak()
  vad.openStream(format, options) / close() on the VadStream it returns
  stt.openStream(format, options)

Messages only. No signatures, bodies, or annotations targets change.
@ayaangazali
ayaangazali force-pushed the fix/kotlin-deprecation-targets branch from 327dfe9 to 4710704 Compare September 2, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants